﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.popups {
    import reprise.ui.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.models.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.utils.*;

    public class DisplayTreatmentCostsCommand extends Command {

        public var event:InfoEvent;
        public var language:LanguageModel;

        override public function execute():void{
            var _local1:String = this.parseTreatmentTime(int(this.event.info.time));
            RepriseUtils.addLabel(UIComponent(this.event.info.container), ("unit " + this.event.id), _local1, "treatmentTime");
        }
        private function parseTreatmentTime(_arg1:int):String{
            var _local7:String;
            var _local8:String;
            var _local2 = 60;
            var _local3 = 3600;
            var _local4:int = (_arg1 % 60);
            var _local5:int = int((_arg1 / _local2));
            var _local6:Number = Numbers.decimalPlaces((_local5 / _local2), 1);
            if (_arg1 < _local2){
                _local7 = _local4.toString();
                _local8 = "global_seconds";
            } else {
                if (_arg1 < _local3){
                    _local7 = _local5.toString();
                    _local8 = "global_minutes";
                } else {
                    _local7 = _local6.toString();
                    _local8 = "global_hours";
                };
            };
            return (this.getUnitString("global_unit_fraction", _local7.toString(), _local8, "global_room"));
        }
        private function getUnitString(_arg1:String, _arg2:String, _arg3:String, _arg4:String):String{
            var _local5:Object = {amount:_arg2, numerator:this.language.getTextByKey(_arg3), denominator:this.language.getTextByKey(_arg4)};
            return (this.language.getTextByKey(_arg1, _local5));
        }

    }
}//package net.wooga.pets.controllers.popups 
